<template>
  <div id="bill">
    <div class="bill_list">
      <div class="bill-items" v-if="dataList.length>0">
        <div class="detail bill-item block" v-for="(item, index) in dataList" :key="index">
          <div class="flex space-between">
            <div class="money">￥{{item.totalMoneyAmount}}元</div>
            <div class="base_btn def_btn" @click="goUrl('center', 'invoiceDetail', item)">查看发票</div>
          </div>
          <div class="line">
            <div class="left-coin"></div>
            <div class="right-coin"></div>
          </div>
          <p><span>·&nbsp;&nbsp;纸质发票 | 租赁发票</span></p>
          <p><span>·&nbsp;&nbsp;{{item.tsUpdate | timeFormat}}</span><span style="float: right; font-weight: bold; color: #FF9600;padding-right: 15px;">物流中</span></p>
          <div class="mark"><img src="./imgs/invoiceYs.png"></div>
          <div style="clear: both;"></div>
        </div>

      </div>
      <div v-else="" style="margin: 0 auto; width: 141px; padding-top: 35%; text-align: center; color: #333333;">
        <img style="width: 100%;" src="./imgs/nothing.png">
        <div>尚无开票信息</div>
      </div>
    </div>
    <mnav cur="3"></mnav>
  </div>
</template>

<script>
  export default {
    name: 'company-bill',
    data () {
      return {
        dataList: []

      }
    },
    created () {
      this.invoiceQueryList();
    },
    methods: {
      goUrl(path, funCode, item) {
        this.$router.push({
          path: '/'+ path,
          query: {
            funCode: funCode,
            id: item.id,
            orderId: item.orderId,
            type: item.type
          }
        })
      },
      //获取发票列表
      invoiceQueryList(){
        this.$http.post('yxc/invoice/queryList',{carWxUserId: localStorage.getItem('wxUserId'), type: '01'}).then(res=>{

          if(res.code == '200') {
            this.dataList = res.data;
          }
        })
      }
    },
    filters: {
      timeFormat: function (value) {
        let date = new Date(value);
        let y = date.getFullYear();
        let MM = date.getMonth() + 1;
        MM = MM < 10 ? ('0' + MM) : MM;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let m = date.getMinutes();
        m = m < 10 ? ('0' + m) : m;
        let s = date.getSeconds();
        s = s < 10 ? ('0' + s) : s;
        return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
      }
    }
  }
</script>

<style lang="scss" scoped>
  #bill {
    margin: 0 10px;
    margin-bottom: 80px;
  }

  h3 {
    margin: 0px 0px;
  }


  .flex {
    display: flex;
  }

  .space-around {
    justify-content: space-around;
  }

  .space-between {
    justify-content: space-between;
  }

  .line{width: 100%; border-bottom: 1px dashed #EEEEEE; margin: 10px auto;position: relative;}
  .left-coin{width: 10px; height: 10px; position: absolute; left: -20px; top:-5px; display: block; background-color: #f8f8f8; border-radius: 50%;}
  .right-coin{width: 10px; height: 10px; position: absolute; right: -20px; top:-5px; display: block; background-color: #f8f8f8; border-radius: 50%;}

  .block {
    margin: 10px auto;
    border-radius: 10px;
    background-color: #fff;
    padding: 15px 15px;

  .infos {
    font-size: 14px;
    color: #333;
  }

  }

  .base_btn{display: inline-block; padding: 0px 20px;border-radius: 5px; height: 32px; line-height: 32px;text-align: center;}
  .detail{
    font-size:13px;
    .def_btn{border:1px solid #A0A0A0;border-radius:5px; color: #333333;  padding: 0 10px;}
  }
  .detail p{color: #333333;}
  .detail p span:first-child{color: #999999;}
  .detail p .is-wait{color:#FF5D32; font-weight: bold;}
  .detail p .is-over{color:#999999 !important; font-weight: bold;}
  .bill-item{position: relative;}
  .bill-item .money{font-size: 20px; color: #FF9600;}

  .mark{
    width: 85px;
    height: 64px;
    position: absolute;
    right: 0px;
    bottom: 0px;
    img{width: 100%;height: 100%;}
  }
</style>
<style>
  .el-step__icon-inner {
    font-weight: normal;
  }


</style>
